﻿using System.Text.Json;
using dotnet.entity;
using dotnet.util;
using Microsoft.AspNetCore.Mvc;

namespace dotnet.Controllers
{
    [Route("api/[controller]")]
    public class LoginController : Controller
    {

        [HttpPost("")]
         public string DoLogin([FromBody] LoginModel loginModel)
         {
            string token =JWTUtil.GenerateJwtToken(loginModel.Username);
            return JsonSerializer.Serialize(new {token = token  });
         }
      
    }
}
